package org.geektimes.projects.user.management;

import org.geektimes.projects.user.domain.User;
import org.geektimes.projects.user.management.standard.mbean.UserServiceManagement;

import javax.management.MBeanServer;
import javax.management.ObjectName;

import java.lang.management.ManagementFactory;

public class UserMBeanDemo {
//    public static void main(String[] args) throws Exception {
//        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
//        ObjectName objectName = new ObjectName("jolokia:name=User");
//        User user = new User();
//        user.setId(1L);
//        user.setEmail("1130876885@qq.com");
//        user.setPassword("123456");
//        user.setPhoneNumber("18379162860");
//        mBeanServer.registerMBean(createUserMBean(user),objectName);
//        while (true){
//            Thread.sleep(2000);
//            System.out.println(user);
//        }
//    }
//
//    private static Object createUserMBean(User user) throws Exception{
//        return new UserServiceManagement(user);
//    }
}
